**************Multiple Comparisons*****************
use "C:\Users\T\Dropbox\Tago Ikeda Collaboration\2012�N���ۗ����c����\IRAP�֘A\����\TagoIkeda2012forReplication_coalition.dta", clear
generate regimechange=0
replace regimechange=1 if pat<9
generate pirates=0
replace pirates=1 if regimechange==0
generate coalition20=0
replace coalition20=1 if pat<5
replace coalition20=1 if pat>8
replace coalition20=0 if pat>12

generate fullresolution=0
replace fullresolution=1 if pat==1
replace fullresolution=1 if pat==9
replace fullresolution=1 if pat==5
replace fullresolution=1 if pat==13
generate narrowresolution=0
replace narrowresolution=1 if pat==2
replace narrowresolution=1 if pat==10
replace narrowresolution=1 if pat==6
replace narrowresolution=1 if pat==14
generate vetoedresolution=0
replace vetoedresolution=1 if pat==3
replace vetoedresolution=1 if pat==11
replace vetoedresolution=1 if pat==7
replace vetoedresolution=1 if pat==15
generate noresolution=0
replace noresolution=1 if pat==4
replace noresolution=1 if pat==12
replace noresolution=1 if pat==8
replace noresolution=1 if pat==16

drop if narrow==1
drop if veto==1

generate both=0
replace both=1 if full==1 & coal==1

generate onlyunscauth=0
replace onlyunscauth=1 if full==1 & coal==0

generate onlycoal=0
replace onlycoal=1 if full==0 & coal==1

generate mdiplom=0
replace mdiplom=1 if both==1
replace mdiplom=1 if onlyunscauth==1
generate maction=0
replace maction=1 if both==1
replace maction=1 if onlycoal==1

generate manipulations=4
replace manipulations=1 if both==1
replace manipulations=2 if onlyunscauth==1
replace manipulations=3 if onlycoal ==1

save "C:\Users\T\Dropbox\Tago Ikeda Collaboration\2012�N���ۗ����c����\IRAP�֘A\����\TagoIkeda2012forReplication_coalition_working.dta", replace

**************Showing How Four Groups Are Balanced*****************
oneway male manipu , tabulate
tab male manipu , chi
oneway age manipu , tabulate
tab age manipu , chi
oneway income manipu , tabulate
tab income manipu , chi
oneway colle manipu , tabulate
tab colle manipu , chi
oneway q17 manipu , tabulate
tab q17 manipu , chi
oneway q01 manipu , tabulate
tab q01 manipu , chi
oneway q02 manipu , tabulate
tab q02 manipu , chi

*Note: Table for balancing is made from the above commands

*Figures for Appendix*
cd D:
import excel using male.xls, firstrow clear
gen upper=mean+1.96*std/sqrt(n)
gen lower=mean-1.96*std/sqrt(n)
tw(bar mean x,xlab(1 "DM=1, OM=1" 2 "DM=1, OM=0" 3 "DM=0, OM=1" 4 "DM=0,OM=0") barwidth(0.4) col(gs8))(rcap upper lower x), b1title("") legend(off) note("Note: Bars indicate 95% confidenceintervals.")
graph display, ysize(5) xsize(6)
graph save g01, replace

*Figures for Appendix*
cd D:
import excel using age.xls, firstrow clear
gen upper=mean+1.96*std/sqrt(n)
gen lower=mean-1.96*std/sqrt(n)
tw(bar mean x,xlab(1 "DM=1, OM=1" 2 "DM=1, OM=0" 3 "DM=0, OM=1" 4 "DM=0,OM=0") barwidth(0.4) col(gs8))(rcap upper lower x), b1title("") legend(off) note("Note: Bars indicate 95% confidenceintervals.")
graph display, ysize(5) xsize(6)
graph save g02, replace

*Figures for Appendix*
cd D:
import excel using income.xls, firstrow clear
gen upper=mean+1.96*std/sqrt(n)
gen lower=mean-1.96*std/sqrt(n)
tw(bar mean x,xlab(1 "DM=1, OM=1" 2 "DM=1, OM=0" 3 "DM=0, OM=1" 4 "DM=0,OM=0") barwidth(0.4) col(gs8))(rcap upper lower x), b1title("") legend(off) note("Note: Bars indicate 95% confidenceintervals.")
graph display, ysize(5) xsize(6)
graph save g03, replace

*Figures for Appendix*
cd D:
import excel using college.xls, firstrow clear
gen upper=mean+1.96*std/sqrt(n)
gen lower=mean-1.96*std/sqrt(n)
tw(bar mean x,xlab(1 "DM=1, OM=1" 2 "DM=1, OM=0" 3 "DM=0, OM=1" 4 "DM=0,OM=0") barwidth(0.4) col(gs8))(rcap upper lower x), b1title("") legend(off) note("Note: Bars indicate 95% confidenceintervals.")
graph display, ysize(5) xsize(6)
graph save g04, replace

*Figures for Appendix*
cd D:
import excel using q17.xls, firstrow clear
gen upper=mean+1.96*std/sqrt(n)
gen lower=mean-1.96*std/sqrt(n)
tw(bar mean x,xlab(1 "DM=1, OM=1" 2 "DM=1, OM=0" 3 "DM=0, OM=1" 4 "DM=0,OM=0") barwidth(0.4) col(gs8))(rcap upper lower x), b1title("") legend(off) note("Note: Bars indicate 95% confidenceintervals.")
graph display, ysize(5) xsize(6)
graph save g05, replace

*Figures for Appendix*
cd D:
import excel using q01.xls, firstrow clear
gen upper=mean+1.96*std/sqrt(n)
gen lower=mean-1.96*std/sqrt(n)
tw(bar mean x,xlab(1 "DM=1, OM=1" 2 "DM=1, OM=0" 3 "DM=0, OM=1" 4 "DM=0,OM=0") barwidth(0.4) col(gs8))(rcap upper lower x), b1title("") legend(off) note("Note: Bars indicate 95% confidenceintervals.")
graph display, ysize(5) xsize(6)
graph save g06, replace

*Figures for Appendix*
cd D:
import excel using q02.xls, firstrow clear
gen upper=mean+1.96*std/sqrt(n)
gen lower=mean-1.96*std/sqrt(n)
tw(bar mean x,xlab(1 "DM=1, OM=1" 2 "DM=1, OM=0" 3 "DM=0, OM=1" 4 "DM=0,OM=0") barwidth(0.4) col(gs8))(rcap upper lower x), b1title("") legend(off) note("Note: Bars indicate 95% confidenceintervals.")
graph display, ysize(5) xsize(6)
graph save g07, replace

use "C:\Users\T\Dropbox\Tago Ikeda Collaboration\2012�N���ۗ����c����\IRAP�֘A\����\TagoIkeda2012forReplication_coalition_working.dta", clear

**************Descriptive Statistics*****************
sum q09 q10 both onlyuns onlycoal pirate male age income colle q17 q01 q02

**************Main Results for Support for Using Force*****************
ttest q09, by(mdiplo) unp
ttest q09, by(mact) unp
ttest q10, by(mdiplo) unp
ttest q10, by(mact) unp

***hypothesis3.xls is created by manually by inserting differences from ttest*** 
cd D:
import excel using hypothesis3.xls, firstrow clear
#delimit;
la define y
	1 "US Use of Force"
	2 "Japanese Coalition Participation";
la val y y;
 tw(rcap U L x || scatter M x, 
 xlab(1 " " 1.3 "DM effect" 1.7 "OM effect" 2 " ")
 lwidth(10) col(gs8)  
 )
,
by(y,
col(2) b1title("") legend(off)
note("Note: 95% confidence intervals for mean difference of manipulation effects.")
)
;
#delimit cr
graph display, ysize(5) xsize(6)
graph save g08, replace

***** Robustness test for different scenarios #Piracy Scenario# *****
use "C:\Users\T\Dropbox\Tago Ikeda Collaboration\2012�N���ۗ����c����\IRAP�֘A\����\TagoIkeda2012forReplication_coalition_working.dta", clear
drop if pirates==0

**************Descriptive Statistics*****************
sum q09 q10 both onlyuns onlycoal pirate male age income colle q17 q01 q02

**************Main Results for Support for Using Force*****************
ttest q09, by(mdiplo) unp
ttest q09, by(mact) unp
ttest q10, by(mdiplo) unp
ttest q10, by(mact) unp

***hypothesis3.xls is created by manually by inserting differences from ttest*** 
cd D:
import excel using hypothesis3pirates.xls, firstrow clear
#delimit;
la define y
	1 "US Use of Force"
	2 "Japanese Coalition Participation";
la val y y;
 tw(rcap U L x || scatter M x, 
 xlab(1 " " 1.3 "DM effect" 1.7 "OM effect" 2 " ")
 lwidth(10) col(gs8)  
 )
,
by(y,
col(2) b1title("") legend(off)
note("Note: 95% confidence intervals for mean difference of manipulation effects.")
)
;
#delimit cr
graph display, ysize(5) xsize(6)
graph save g08p, replace

***** Robustness test for different scenarios #Landing Scenario# *****
use "C:\Users\T\Dropbox\Tago Ikeda Collaboration\2012�N���ۗ����c����\IRAP�֘A\����\TagoIkeda2012forReplication_coalition_working.dta", clear
drop if pirates==1

**************Descriptive Statistics*****************
sum q09 q10 both onlyuns onlycoal pirate male age income colle q17 q01 q02

**************Main Results for Support for Using Force*****************
ttest q09, by(mdiplo) unp
ttest q09, by(mact) unp
ttest q10, by(mdiplo) unp
ttest q10, by(mact) unp

***hypothesis3.xls is created by manually by inserting differences from ttest*** 
cd D:
import excel using hypothesis3landing.xls, firstrow clear
#delimit;
la define y
	1 "US Use of Force"
	2 "Japanese Coalition Participation";
la val y y;
 tw(rcap U L x || scatter M x, 
 xlab(1 " " 1.3 "DM effect" 1.7 "OM effect" 2 " ")
 lwidth(10) col(gs8)  
 )
,
by(y,
col(2) b1title("") legend(off)
note("Note: 95% confidence intervals for mean difference of manipulation effects.")
)
;
#delimit cr
graph display, ysize(5) xsize(6)
graph save g08l, replace
